package com.teamwork.module03.controller;

import com.teamwork.common.result.Result;
import com.teamwork.module03.service.ReplyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/api/reply")
@Slf4j
public class ReplyController {

   @Resource
   private ReplyService replyService;


    @PostMapping("/{userid}")
    public Result replyOne(@PathVariable("userid")Integer userid, @RequestBody Map<String,Object> map){

        Integer articleid = (Integer) map.get("articleid");
        Integer commentid = (Integer) map.get("commentid");
        String reply = (String) map.get("reply");

        return replyService.toreply(userid,articleid,commentid,reply);
    }


}
